<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>函数传参</title>
    <style>
        #div1{
           width:200px;height:200px; background:red;
        }
    </style>
    <script>
        function toGreen(){
            var oDiv=document.getElementById("div1");
            oDiv.style.background='green';
        }
        function toYellow(){
           var oDiv=document.getElementById("div1");
           oDiv.style.background='yellow';
        }
        function toBlack(){
            var oDiv=document.getElementById("div1");
            oDiv.style.background='black';
        }
    </script>
</head>
<body>
<input type="button" value="变绿" onclick="toGreen()">
<input type="button" value="变黄" onclick="toYellow()">
<input type="button" value="变黑" onclick="toBlack()">
 <div id="div1"></div>
</body>
</html>